<admintpl file="header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:U('Admin/Vote/index')}">投票列表</a></li>
    </ul>
    <form class="well form-search" id="query_form" method="post" action="{:U('Admin/Vote/index')}">
        投票标题：
        <input type="text" id="newsTitle" name="vote_name" style="width: 120px;" value="" placeholder="投票标题...">

        <input type="submit" name="query_form_btn" id="queryBtn" data-action="{:U('Admin/Vote/index')}" class="btn btn-primary" value="查询"/>
        <br/><br/>

        <a href="{:U('Admin/Vote/addVote')}" class="btn btn-primary" >发布投票</a>
        <a  class="btn btn-primary"  id="newsDel">删除</a>&nbsp;&nbsp;
    </form>

    <form class="js-ajax-form" action="" method="post">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
            	<th></th>
                <th>投票名称</th>
                <th>创建时间</th>
                <th>开始时间</th>
                <th>截止时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="carousel_figure_vo">
                <tr>
                	<td><input name="news_ids[]"  type="checkbox" value="{$carousel_figure_vo.vote_id}"></td>
                    <td>{$carousel_figure_vo.title}</td>
                    <td>{$carousel_figure_vo.create_time|date="Y-m-d H:i:s",###}</td>
                    <td>{$carousel_figure_vo.start_time|date="Y-m-d H:i:s",###}</td>
                    <td>{$carousel_figure_vo.end_time|date="Y-m-d H:i:s",###}</td>
                    <td>
                        <a id="add" href="{:U('vote/options', array('id'=>$carousel_figure_vo['vote_id']))}" onclick="">查看选手</a>
                        <a id="edit" href="{:U('Vote/addVote', array('id'=>$carousel_figure_vo['vote_id']))}">修改</a>
                        <a id="yulan" target="_blank" href="<?php echo $vote_domain.$carousel_figure_vo['vote_id'];?>">预览</a>
                        <a id="tongji" href="{:U('Vote/Statistical', array('id'=>$carousel_figure_vo['vote_id']))}">统计</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
    <div class="pagination">{$page}</div>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    $("#newsDel").click(function(){
        var boxes = $("[name='news_ids[]']");
        var news_checbox = []
        for(i=0;i<boxes.length;i++){
            if(boxes[i].checked == true){
                news_checbox.push(boxes[i].value);
            }
        }

        if(news_checbox == ''){
            alert('请选择要删除的投票!');
            return false;
        }
        $.post("<?php echo U('Admin/Vote/VoteDel')?>",{news_checbox:news_checbox},function(result){
            if(result > '0'){
                var msg = '删除成功';
            }else{
                var msg = '删除失败';
            }

            alert(msg);
            location.reload();
        });
    })
</script>
</body>
</html>